RELEASE_NAME?=flink-kubernetes-operator
CHART_VERSION?=1.10.0
NAMESPACE?=flink
export

.PHONY: prepare_helm_repo install

prepare_helm_repo:
	-kubectl create ns ${NAMESPACE}
	-helm repo add flink-operator-repo https://downloads.apache.org/flink/flink-kubernetes-operator-${CHART_VERSION}
	-kubectl create -f https://github.com/jetstack/cert-manager/releases/download/v1.8.2/cert-manager.yaml
	-helm repo update
	-helm show values flink-operator-repo/flink-kubernetes-operator > ./flink-operator-values.yaml --version ${CHART_VERSION}

install:
	helm install -f flink-operator-values.yaml ${RELEASE_NAME} flink-operator-repo/flink-kubernetes-operator \
	--version ${CHART_VERSION} -n ${NAMESPACE} \
	--set webhook.create=false

# kubectl apply -f https://raw.githubusercontent.com/apache/flink-kubernetes-operator/release-1.10/examples/basic.yaml
# kubectl apply -f tests/basic.yaml

template:
	helm template -n ${NAMESPACE} ${RELEASE_NAME} flink-operator-repo/flink-kubernetes-operator --debug --version ${CHART_VERSION} > ./build/flink-operator-values_test.yaml

delete:
	-helm uninstall -n ${NAMESPACE} ${RELEASE_NAME}